home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / resources / templates / search.js < prev    next >
Encoding:
JavaScript  |  2007-11-12  |  1.7 KB  |  65 lines

  1. /*
  2. # Miro - an RSS based video player application
  3. # Copyright (C) 2005-2007 Participatory Culture Foundation
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  18. */
  19.  
  20. function performSearch()
  21. {
  22.     fillSearch()
  23.     engine = document.forms['search']['engines'].value;
  24.     query =  document.forms['search']['query'].value;
  25.     url = 'action:'
  26.     
  27.     if (query == '')
  28.     {
  29.         url = url + 'resetSearch?'
  30.     }
  31.     else
  32.     {
  33.         url = url + 'performSearch?engine=' + engine;
  34.         url = url + '&query=' + URLencode(query);
  35.     }
  36.     
  37.     return eventURL(url);
  38. }
  39.  
  40. function updateLastSearchEngine()
  41. {
  42.     engine = document.forms['search']['engines'].value;
  43.     updateUrl =  'action:updateLastSearchEngine?engine=' + engine;
  44.     eventURL(updateUrl)
  45.     return true;
  46. }
  47.  
  48. function fillSearch()
  49. {
  50.     query =  document.forms['search']['query'].value;
  51.     updateUrl =  'action:updateLastSearchQuery?query=' + URLencode(query);
  52.     eventURL(updateUrl)
  53.     return true;
  54. }
  55.  
  56. function validateSearch(e)
  57. {
  58.     if (getKeyFromEvent(e) == 13)
  59.     {
  60.         return performSearch();
  61.     }
  62.  
  63.     return true;
  64. }
  65.